The length property returns the length of a string.
Syntax:- text.length
Enter value:-
2)Slice(Start , end)
slice() extracts a part of a string and returns the extracted part in a new string. The method takes 2 parameters: the start position, and the end position (end not included).
Syntax:- text.slice(start, end)
Enter value:- , Enter start value:- , Enter end value:-
3)Substring(Start , end)
substring() is similar to slice(). The difference is that start and end values less than 0 are treated as 0 in substring().
Syntax:- text.substring(start, end)
Enter value:- , Enter start value:- , Enter end value:-
4)Substr(Start , length)
substr() is similar to slice(). The difference is that the second parameter specifies the length of the extracted part.
Syntax:- text.substr(start, length)
Enter value:- , Enter start value:- , Enter length value:-
5)Replace
The replace() method replaces a specified value with another value in a string.
Syntax:- text.replace(what replace , what put) use a regular expression with an /i flag (for insensitive) [eg., text.replace(/what replace/i , what put)] use a regular expression with a /g flag ( for global match) [eg., text.replace(/what replace/g , what put)]
Enter value:- , Enter What replace:- , Enter what put:-
6) toUpperCase()
A string is converted to upper case with toUpperCase()
Syntax:- text.toUpperCase()
Enter value:-
7) toLowerCase()
A string is converted to lower case with toLowerCase()
Syntax:- text.toLowerCase()
Enter value:-
8) concat()
concat() joins two or more strings.
Syntax:- text1.concat(text2)
Enter first value:-
Enter second value:-
9) trim()
The trim() method removes whitespace from both sides of a string
Syntax:- text.trim()
Enter value:-
A)trimStart()
The trimStart() method works like trim(), but removes whitespace only from the start of a string.
Syntax:- text.trimStart()
Enter value:-
B)trimEnd()
The trimEnd() method works like trim(), but removes whitespace only from the end of a string.
Syntax:- text.trimEnd()
Enter value:-
10) Padding()
A)padStart()
The padStart() method pads a string with another string
Enter value:-
Enter length number:-
Enter any value:-
B)padEnd()
The padEnd() method pads a string with another string
Syntax:- text.padEnd(length number,"any value");
Enter value:-
Enter length number:-
Enter any value:-
11) charAt()
The charAt() method returns the character at a specified index (position) in a string
Syntax:- charAt(position number)
Enter value:-
Enter position number:-
12) charCodeAt()
The charCodeAt() method returns the unicode of the character at a specified index in a string The method returns a UTF-16 code (an integer between 0 and 65535).
Syntax:- charCodeAt(position number)
Enter value:-
Enter position number:-
13) Property Access
ECMAScript 5 (2009) allows property access [ ] on strings.
Syntax:- text[position number]
Enter value:-
Enter position number:-
14) split()
A string can be converted to an array with the split() method. If the separator is omitted, the returned array will contain the whole string in index [0]. If the separator is "", the returned array will be an array of single characters
Syntax:- text.split("value")
Enter value:-
Enter value:-
** String Search Methods**
15) indexOf()
The indexOf() method returns the index of (the position of) the first occurrence of a specified text in a string. -1 value show wrong number(value) or error or text is not found etc. parameter number use for find same word but different line.
Syntax:- text.indexOf("Enter finding word", Enter parameter number(length form))
Enter sentences:-
Enter finding word :-
Enter parameter number:-
16) lastindexOf()
The lastIndexOf() methods searches backwards (from the end to the beginning), meaning: if the second parameter is 15, the search starts at position 15, and searches to the beginning of the string. -1 value show wrong number(value) or error or text is not found etc.
Syntax:- text.indexOf("finding word")
Enter sentences:-
Enter finding word :-
Enter parameter number:-